package ces.lawsuit.model;

import com.jfinal.plugin.activerecord.Page;

public class Menu extends BaseModel<Menu> {
	public static final Menu me = new Menu();
	public static final String PARENT_MENU_SQL="SELECT *   FROM T_MENU WHERE PARENTMENU IS NULL ORDER BY SORT ";
	public static final String ALL_ITEM_MENU_SQL="SELECT *  FROM  T_MENU WHERE PARENTMENU IS NOT NULL ORDER BY PARENTMENU,SORT";
	public static final String LIST_SQL="SELECT *   FROM T_MENU ORDER BY SORT ASC";
	public static final String PARENT_LIST_SQL="SELECT *  FROM  T_MENU T WHERE T.PARENTMENU IS NULL AND ID!=? ORDER BY SORT";
	public static final String PAGINATE_SQL="FROM (SELECT T.*,B.NAME PNAME FROM T_MENU T LEFT JOIN T_MENU B B.ID=T.PMENU)";
	public Page<Menu> paginate(int pageNumber, int pageSize) {
		return paginate(pageNumber, pageSize, "SELECT *", "FROM T_MENU ORDER BY SORT ASC");
	}
}
